FROM zhilink/ubuntu:14.04.1
#FROM 172.31.75.188/zhilink/ubuntu:14.04.1_v01
MAINTAINER hardyxia <1009254417@qq.com>

#ADD http://download.xiamujun.cn/mysql-5.5.48-linux2.6-x86_64.tar.gz /opt/
ADD http://dev.mysql.com/get/Downloads/MySQL-5.5/mysql-5.5.48-linux2.6-x86_64.tar.gz /opt/
#COPY mysql-5.5.48-linux2.6-x86_64.tar.gz /opt/

#安装配置mysql
RUN apt-get install  libaio1 libaio-dev -y && \
    cd  /opt/ && tar xf mysql-5.5.48-linux2.6-x86_64.tar.gz  &&  \
    mv mysql-5.5.48-linux2.6-x86_64 /usr/local/mysql  && \
    rm -rf /opt/mysql-5.5.48-linux2.6-x86_64.tar.gz  && \
    cd /usr/local/mysql && \ 
    mkdir data && \
    useradd mysql && \
    chown -R mysql:mysql data && \
    cp /usr/share/zoneinfo/Asia/Shanghai   /etc/localtime  &&\
    ./scripts/mysql_install_db --user=mysql --datadir=/usr/local/mysql/data --basedir=/usr/local/mysql 

#mysql模版配置文件
COPY my.cnf /etc/my.cnf 
COPY mysql /etc/init.d/mysql
RUN chmod +x  /etc/init.d/mysql
ENV PATH $PATH:/usr/local/mysql/bin

#初始化文件
ADD start.sh /start.sh

EXPOSE 3306

#启动
CMD ["/start.sh"]  

